package com.jxl.wechat.handler;

import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class WeChatSubscribHandler implements WeChatMsgHandler{
    @Override
    public WeChatMsgTypeEnums getMsgType() {
        return WeChatMsgTypeEnums.SUBSCRIBE;
    }

    @Override
    public String deal(Map<String, String> map) {
        String fromUserName = map.get("FromUserName");
        String toUserName = map.get("ToUserName");
        String subscribeContent = "感谢您的关注，我是吕奉先！欢迎来学习从0到1社区项目";
        String content = "<xml>\n" +
                "  <ToUserName><![CDATA[" + fromUserName + "]]></ToUserName>\n" +
                "  <FromUserName><![CDATA[" + toUserName + "]]></FromUserName>\n" +
                "  <CreateTime>12345678</CreateTime>\n" +
                "  <MsgType><![CDATA[text]]></MsgType>\n" +
                "  <Content><![CDATA[" + subscribeContent + "]]></Content>\n" +
                "</xml>";
        return content;

    }
}
